<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_role_unique_id', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('角色唯一id');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('user_id')->comment('账号id')->unsigned()->default(0);
            $table->integer('server_id')->comment('服务器id')->unsigned()->default(0);
            $table->bigInteger('role_id')->comment('角色id')->unsigned()->default(0);

            $table->index('create_time');
            $table->index('user_id');
            $table->index('server_id');
            $table->index('role_id');
        });

        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `user_role_unique_id` AUTO_INCREMENT=10000001;");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_role_unique_id');
    }
};
